/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package diet.utils;

import diet.XMLUtils.XMLAutoGenerate;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 *
 * @author Vrety
 */
public class Config implements ServletContextListener {

    private ExecutorService executor;

    public void contextInitialized(ServletContextEvent event) {
        executor = Executors.newSingleThreadExecutor();
        executor.submit(new XMLAutoGenerate(event.getServletContext().getRealPath("/"))); // Task should implement Runnable.
    }

    public void contextDestroyed(ServletContextEvent event) {
        executor.shutdown();
    }

}